= render "projects/commits/head"

%h3.page-title
  Compare View

= render "form"

- if @commits.present?
  %div.ui-box
    .title
      Commits (#{@commits.count})
    - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
      %ul.well-list
        - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit|
          = render "projects/commits/inline_commit", commit: commit, project: @project
        %li.warning-row.unstyled
          other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues.
    - else
      %ul.well-list= render Commit.decorate(@commits), project: @project

  %h4 Changes
  - if @diffs.present?
    = render "projects/commits/diffs", diffs: @diffs, project: @project
  - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
    .bs-callout.bs-callout-danger
      %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
      %p To preserve performance the line changes are not shown.
  - elsif @timeout
    .bs-callout.bs-callout-danger
      %h4 Number of changed files for this comparison is extremely large.
      %p Use command line to browse through changes for this comparison.


- else
  .light-well
    %center
      %h4
        There isn't anything to compare.
      %p.slead
        - if params[:to] == params[:from]
          You'll need to use different branch names to get a valid comparison.
        - else
          %span.label-branch #{params[:from]}
          and
          %span.label-branch #{params[:to]}
          are the same.
